<?php
/**
* Lists out entries, albums, etc.
*/
function smarty_function_listof($params=array(), &$smarty)
{
	$type = isset($params['type'])?$params['type']:'';
	$from = isset($params['from'])?(int)$params['from']:0;
	
	$urls = array();
	
	$db = new mysql();	
	switch(strtolower($type))
	{
	case 'albums_of_image':
		$sql="
SELECT
	a.album_name,
	a.album_id
FROM gallery_images_albums ia
INNER JOIN gallery_albums a ON
	a.album_id = ia.album_id
	AND a.is_active='Y'
WHERE
	ia.image_id={$from}
	AND ia.is_active='Y'
	AND ia.is_approved='Y'
;";
		$albums = $db->arrays($sql);
		foreach($albums as $a => $album)
		{
			# link to: images-albums.php?id=1&code=ad6defc0c7ad75b6564157e48cdc76b5
			$urls[] = "<a href='images-albums.php?id={$album['album_id']}&amp;code='>{$album['album_name']}</a>";
			
			#$urls[] = "<a href='album.php?id={$album['album_id']}'>{$album['album_name']}</a>";
		}
		break;
	case 'categories_of_image':
		break;
	}
	
	return implode(' | ', $urls);
}
?>